<template>
  <div class="app-container">
    <el-table
      :data="tableData"
      style="width: 100%;margin-bottom: 20px;"
      row-key="path"
      default-expand-all
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
      <el-table-column
        prop="name"
        label="菜单名称"
        sortable
        width="180">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getRouters } from '@/api/menu'

export default {
  data() {
    return {
      tableData: []
    }
  },
  created() {
    this.getRouters()
  },
  methods: {
    // 获取路由列表
    getRouters(){
      getRouters().then(response => {
        this.tableData = response.data
      })
    }
  }
}
</script>
